package com.lone.design.pattern.creational.singleton.demo3;

import com.lone.design.pattern.creational.singleton.demo2.Singleton;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author Lone
 * @date 2021/9/24 9:11 周五
 */
public class SingletonTest {
    public static void main(String[] args) {
        ExecutorService threadPool = Executors.newFixedThreadPool(10);
        for (int i = 0; i < 100; i++) {
            threadPool.execute(()->System.out.println("线程名称：" + Thread.currentThread().getName() + "，执行" + Singleton.getInstance()));
            /*try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }*/
        }
    }
}
